// 1002.cpp : Defines the entry point for the console application.
//
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
using namespace std;

#define MAX_COUNT 1000

struct Elephant
{
	int weight;
	int iq;
	int pos;

	bool compare_by_iq( const Elephant& e ) const 
	{
		if( e.iq != this->iq )
		{
			return e.iq < this->iq;
		}
		return e.weight < this->weight;
	}

	bool compare_by_weight( const Elephant& e ) const 
	{
		return this->weight < e.weight;
	}
};

template< typename _T, typename _Pr, typename _Fn1 >
void find_lis( _T* a, int size, _Pr pr, _Fn1 fn)
{
	vector<int> b, p(size);
	int u, v;
 
	if (size < 1)
	{
		fn( a, &b[0], b.size() );
	}
 
	b.push_back(0);
 
	for (size_t i = 1; i < size; i++) {
		if ( pr( a[b.back()], a[i] ) )
		{
			p[i] = b.back();
			b.push_back(i);
			continue;
		}
 
		for (u = 0, v = b.size()-1; u < v;) {
			int c = (u + v) / 2;
			if ( pr( a[b[c]], a[i] ) ) u=c+1; else v=c;
		}
 
		if ( pr( a[i], a[b[u]] ) ) {
			if (u > 0) p[i] = b[u-1];
			b[u] = i;
		}	
	}
 
	for (u = b.size(), v = b.back(); u--; v = p[v]) b[u] = v;
	fn( a, &b[0], b.size() );
}


template< typename _T, typename _Pr, typename _Fn1 >
void find_lis2( _T* X, int count, _Pr pr, _Fn1 f )
{
	int M[ MAX_COUNT + 1];
	int P[ MAX_COUNT + 1];
	M[0] = 0;

	int L = 0;
	for( int i = 0; i < count; i++ )
	{
		int j = 0;
		if( L > 0 )
		{
			if( pr( X[ M[L] ], X[i] ) )
			{
				j = L;
			}
			else
			{
				int l = 1;
				int h = L - 1;
				while( l < h )
				{
					int k = ( l + h ) / 2;
					if( pr( X[ M[k] ], X[i] ) ) 
						l = k + 1;
					else
						h = k;
				}

				if ( pr( X[ M[l] ], X[i] ) ) j = l; else j = l - 1;
			}
		}

		P[i] = j == 0 ? -1 : M[j];
		if( j == L || pr( X[i], X[ M[j + 1] ] ) )
		{
			M[j + 1] = i;
			if( L < j + 1 ) L = j + 1;
		}
	}

	int rlist[ MAX_COUNT ];
	int* ri = rlist;
	int pos = M[L];
	while( pos != -1 )
	{
		*(ri++) = pos;
		pos = P[pos];
	}

	f( X, rlist, ri - rlist );

}


void print_ans( Elephant* begin, int* rlist, int count )
{
	cout << count << endl;
	for( int i = count - 1; i >= 0 ; i-- )
	{
		cout <<  begin[ rlist[i] ].pos << endl;
	}

}

int main( int agrc, char* argv[] )
{
	Elephant R[ MAX_COUNT ];

	int elephant_count = 0;
	while( cin >> R[ elephant_count ].weight >> R[ elephant_count ].iq )
	{
		R[ elephant_count ].pos = elephant_count + 1;
		elephant_count++;
	}

	std::sort( R, R + elephant_count, mem_fun_ref( &Elephant::compare_by_iq ) );
	find_lis2( R, elephant_count, mem_fun_ref( &Elephant::compare_by_weight ), print_ans );

	return 0;
}
